package com.wsk.controller;

import com.wsk.bean.User;
import com.wsk.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Maibenben on 2017/1/19.
 */
@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @RequestMapping("/save")
    @ResponseBody
    public Map save(){
        User user=new User();
        user.setName("wsk");
        HashMap<String, String> map = new HashMap<>();
        if (loginService.saveUsers(user)) {
            map.put("save", "1");
        }
        else
            map.put("save", "0");
        return map;
    }
}
